Kết nối LINQ to XML Ngôn_ngữ_truy_vấn_tích_hợp

LINQ to XML cung cấp giao diện lập trình XML trong bộ nhớ giúp Truy vấn tích hợp ngôn ngữ trên .NET (LINQ) thao tác trên các dữ liệu dạng XML. LINQ to XML cung cấp khả năng cho phép .NET có thể cập nhật, cấu trúc lại và truy vấn dữ liệu ở dạng Mô hình đối tượng văn bản (DOM).[6]

// Lấy thông tin từ tệp văn bản dạng XML (PurchaseOrder.xml) chứa dữ liệu về đơn hàng đã thanh toánvar filename = "PurchaseOrder.xml";var currentDirectory = Directory.GetCurrentDirectory();var purchaseOrderFilepath = Path.Combine(currentDirectory, filename);XElement purchaseOrder = XElement.Load(purchaseOrderFilepath);IEnumerable<string> partNos =  from item in purchaseOrder.Descendants("Item")                               select (string) item.Attribute("PartNumber");

Tài liệu tham khảo

WikiPedia: Ngôn_ngữ_truy_vấn_tích_hợp http://download.microsoft.com/download/5/8/6/58680... https://docs.microsoft.com/en-us/dotnet/csharp/pro... https://docs.microsoft.com/en-us/dotnet/framework/... https://docs.microsoft.com/en-us/dotnet/standard/l... https://docs.microsoft.com/en-us/dotnet/standard/l... https://docs.microsoft.com/en-us/dotnet/standard/p... https://docs.microsoft.com/en-us/dotnet/visual-bas... https://web.archive.org/web/20200919121407/https:/... https://web.archive.org/web/20220114025304/https:/... https://web.archive.org/web/20220114032348/https:/...